﻿using BDShop.Configuration;
using BDShop.Entities;
using BDShop.Framework;
using BDShop.Framework.Caching;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BDShop.Business.Cache
{
    public class TagCache : BaseCache<List<Tag>>
    {
        public TagCache()
            : base(BDShopConfiguration.Cache.CacheTag, TagService.GetListTagCacheModel, true, CacheManager.GetFilePathFO(CacheEnum.tag))
        {

        }

        public static TagCache Instance
        {
            get
            {
                return SingletonBase<TagCache>.Instance;
            }
        }

        public static Tag GetByID(int tagID)
        {
            //Get tag from cache
            return TagCache.Instance.Get().Where(t=>t.ID==tagID).FirstOrDefault();            
        }
    }
}
